
#ifndef __WeatherViewController__ViewController__
#define __WeatherViewController__ViewController__

#include "RootWindow.h"
#include "WeatherView.h"


#define gaode_reg_key "b1ee2d04660610e20a8d24923aa3d915"
#define get_default_city_url "http://restapi.amap.com/v3/ip"
#define get_weather_url "http://restapi.amap.com/v3/weather/weatherInfo"


class WeatherViewController :public CAViewController, public CAScrollViewDelegate
{
    
public:

	WeatherViewController();
    
	virtual ~WeatherViewController();
    
	void viewDidLoad();
    
    void viewDidUnload();

	void viewDidAppear();

	void viewDidDisappear();

	void keyBackClicked();

	void scrollViewHeaderBeginRefreshing(CAScrollView* view);

	void onButtonSwitchCity(CAControl* target, CCPoint point);

	void getCurrentCity();
	void getBaseWeather(const std::string& szCity, bool v);
	void getWeatherDatas();

	void onGetCityRetFinished(const HttpResponseStatus& status, const CSJson::Value& json);
	void onGetWeatherRetFinished(const HttpResponseStatus& status, const CSJson::Value& json);

private:
	WeatherData m_wData;

	CWeatherView* m_pWeatherView;

	std::vector<std::string> m_cszXinQiVect;
};


#endif
